package com.wwdx.service.impl;

import com.google.common.collect.Maps;
import com.wwdx.model.WwdxMerchantModel;
import com.wwdx.service.WwdxMerchantServiceI;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author liguoliang
 * @date 2017/12/20 18:47
 */
@Service
public class WwdxMerchantServiceImpl extends BaseServiceImpl<WwdxMerchantModel> implements WwdxMerchantServiceI{

    @Override
    public Long selectModelCount(WwdxMerchantModel model) {
        Map<String, Object> params = Maps.newHashMapWithExpectedSize(4);
        String hql = "select count(1) from WwdxMerchantModel\t"+getParams(model,params);
        return count(hql,params);
    }

    private String getParams(WwdxMerchantModel model, Map<String, Object> params){
        StringBuilder sb = new StringBuilder("where 1=1\n");
        return sb.toString();
    }

    @Override
    public List<WwdxMerchantModel> selectModelList(WwdxMerchantModel model, Integer page, Integer rows) {
        Map<String, Object> params = Maps.newHashMapWithExpectedSize(4);
        String hql = "from WwdxMerchantModel\t"+getParams(model,params)+"\torder by gmt_created desc";
        return find(hql, params, page, rows);
    }
}